﻿<!DOCTYPE html public '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html lang="en">
<head profile="http://www.w3.org/2006/03/hcard">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>CSS Exclusions and Shapes Module Level 3</title>
  <link rel="stylesheet" type="text/css" href="../shared/style/default.css" />
  <script src='https://test.csswg.org/harness/annotate.js#CSS3-EXCLUSIONS_DEV' type='text/javascript' defer></script>


  <style type="text/css">
    .singleImgExample {
    	display: block;
    	margin: auto;
    }
    
    .example-table {
    	table-layout: fixed; 
    	width: 100%; 
    }
    
    .example-table tr td img {
    	width: 90%;
    }
  </style>  
       
       <link rel="stylesheet" type="text/css"
        href="https://www.w3.org/StyleSheets/TR/W3C-ED.css">
        
        <link rel="stylesheet" type="text/css"
         href="../shared/style/issues.css">

       <link id="st" href="../shared/style/alternate-spec-style.css" rel="stylesheet" 
              type="text/css" title="alternate spec style">     


</head>
<body>
    <div id="div-head" class="head">
        <p><a href="http://www.w3.org/"><img id="mobile-logo" alt="W3C" height="53" src=
        "https://www.w3.org/2008/site/images/logo-w3c-mobile-lg" width="90"></a> 
        
        
        <!--begin-logo-->

        <p><a href="http://www.w3.org/"><img id="logo" alt="W3C" height="48" src=
        "https://www.w3.org/Icons/w3c_home" width="72"></a> <!--end-logo--></p>
        <h1 id="css-exclusions-module">CSS Exclusions and Shapes Module Level 3</h1>
        <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
        <dl>
            <dt>This version:</dt>
            <dd><a href="https://drafts.csswg.org/css3-exclusions/">https://drafts.csswg.org/css3-exclusions/</a></dd>
            <!--<dd><a href="[VERSION]">https://www.w3.org/TR/[YEAR]/WD-css3-exclusions-[CDATE]/</a></dd>-->

            <dt>Latest version:</dt>
            <dd><a href="https://www.w3.org/TR/[SHORTNAME]/">https://www.w3.org/TR/[SHORTNAME]/</a></dd>

            <dt>Editor's Draft:</dt>
            <dd><a href="https://drafts.csswg.org/[SHORTNAME]/">https://drafts.csswg.org/[SHORTNAME]/</a>

            <dt>Previous version:</dt>
            <dd>None</dd>

            <dt>Editors:</dt>
            <dd class="vcard"><span class="fn">Vincent Hardy</span>, <span class="org">Adobe Systems, Inc.</span>, <span class="email">vhardy@adobe.com</span></dd>
            <dd class="vcard"><span class="fn">Rossen Atanassov</span>, <span class="org">Microsoft Corporation</span>, <span class="email">ratan@microsoft.com</span></dd>
            <dd class="vcard"><span class="fn">Alan Stearns</span>, <span class="org">Adobe Systems, Inc.</span>, <span class="email">stearns@adobe.com</span></dd>

            <dt>Issues List:</dt>
            <dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Exclusions&amp;resolution=---&amp;cmdtype=doit">in Bugzilla</a></dd>

  <dt>Feedback:</dt>
    <dd><a href="mailto:www-style@w3.org?subject=%5B[css-exclusions]%5D%20feedback"
         >www-style@w3.org</a> 
         with subject line &ldquo;<kbd>[css-exclusions] 
         <var>&hellip; message topic &hellip;</var></kbd>&rdquo;
         (<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
           >archives</a>)

        </dl>
        <!--copyright-->
        <hr title="Separator for header">
    </div>

    <h2 class="no-num no-toc" id="abstract">Abstract</h2>
        
        
    <p>
        CSS Exclusions define arbitrary areas around which <a href="https://www.w3.org/TR/CSS2/visuren.html#inline-boxes">inline content</a> ([[!CSS21]]) content can flow.
    CSS Exclusions can be defined on any CSS block-level elements. CSS
    Exclusions extend the notion of content wrapping previously limited to
    floats.</p>

    <p>CSS Shapes control the geometric shapes used for wrapping inline flow
    content outside or inside an element. CSS Shapes can be applied to any
    element. A circle shape on a float will cause inline content to wrap around
    the circle shape instead of the float's bounding box.</p>

    <p>Combining CSS Exclusions and CSS Shapes allows sophisticated layouts,
    allowing interactions between shapes in complex positioning schemes.</p>

    <h2 class="no-num no-toc" id="status">Status of this document</h2>
    <!--status-->
   
    <h2 class="no-num no-toc" id="contents">Table of contents</h2>
    <!--toc-->

    <h2 id="intro">Introduction</h2>
    <p><em>This section is not normative.</em></p>
    <p>
        The exclusions section of this specification defines features that allow inline flow 
        content to wrap around outside the <span>exclusion area</span> of elements. 
    </p>
    <p>
        The shapes section of the specification defines properties to control the geometry of
        an element's <span>exclusion area</span> as well as the geometry used for wrapping 
        an element's inline flow content.
    </p>

    <h2 id="definitions">Definitions</h2>
    
    <dfn>Exclusion box</dfn>
    
    <p>
        A <a href="https://www.w3.org/TR/css3-box/">box</a> ([[!CSS3BOX]]) that defines an <span>exclusion area</span> for other boxes. The 'wrap-flow'
        property is used to make an element's generated box an exclusion box. An exclusion box contributes
        its <span>exclusion area</span> to its <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">
        containing block's</a> <span>wrapping context</span>. An element with a 'float'
        computed value other than 'none' does not become an exclusion.
    </p>
    
    <dfn>Exclusion area</dfn>

    <p>
        The area used for excluding inline flow content around an exclusion box. The
        <span>exclusion area</span> is equivalent to the <a href="https://www.w3.org/TR/CSS2/box.html#box-dimensions">
        border box</a> for an exclusion box.
        This specification's
        'shape-outside' property 
        can be used to define arbitrary, 
        non-rectangular <span>exclusion areas</span>. 
        The 'shape-inside' property also defines an <span>exclusion area</span>, 
        but in this case it is the area outside the shape that inline content avoids.
    </p>
    
    <dfn>Float area</dfn>
    
    <p>
        The area used for excluding inline flow content around a float element. By default, the
        float area is the float element's 
        <a href="https://www.w3.org/TR/CSS2/box.html#box-dimensions">margin box</a>.
        This specification's
        'shape-outside' property can be used to define arbitrary, non-rectangular float
        areas.
    </p>
        
    <dfn>Exclusion element</dfn>
    
    <p>An block-level element which is not a float and generates an <span>exclusion box</span>. 
        An element generates an exclusion box when its 'wrap-flow' property's computed value is not 'auto'.
    </p>
    
    
    <dfn>Wrapping context</dfn>
    <div class="issue-marker" data-bug_id="15086" data-bug_status="NEW">
        <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15086">Issue-15086</a>
        <div class="issue-details">
            <p class="short-desc">should the wrapping context be generic and include floats?</p>
        </div>
    </div>
    
    <p>
        The <span>wrapping context</span> of a box is a collection of <span>exclusion areas</span> 
        contributed by its associated <span>exclusion boxes</span> and elements with 'shape-inside'. During layout,
        a box wraps its inline flow content in the <code>wrapping area</code> that corresponds to the subtraction of
        its <span>wrapping context</span> from its own <span>content area</span>.
    </p>
    
    <p>
        A box inherits its 
        <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a> 
        <span>wrapping context</span> unless it specifically 
        resets it using the 'wrap-through' property.
    </p>
    
    <dfn>Content area</dfn>
    <p>
        The <a href="https://www.w3.org/TR/CSS2/box.html#box-dimensions">content area</a> 
        is normally used for layout of the inline flow content of a box.
    </p>

    <dfn>Wrapping area</dfn>
    <p>
        The area used for layout of inline flow content of a box affected by a <span>wrapping context</span>, defined by subtracting the <span>wrapping context</span> from its <span>content area</span>
    </p>

    <div class="issue-marker" data-bug_id="15089" data-bug_status="NEW">
      <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15089">Issue-15089</a>
      <div class="issue-details">
          <p class="short-desc">shrink-to-fit circle / shape</p>
      </div>  
    </div>
    
    <dfn title="outside-inside">Outside and inside</dfn>
    
    <p>
        In this specification, 'outside' refers to DOM content that is not a descendant of an element 
        while 'inside' refers to the element's descendants.
    </p>
    
    <h2 id="exclusions">Exclusions</h2>
    <p>
        Exclusion elements define <span>exclusion areas</span> that contribute to their containing block's 
        <span>wrapping context</span>. As a consequence, exclusions impact the layout of their 
        containing block's descendants.
    <p>
        
    <p>
        Elements layout their inline content in their <span>content area</span> and wrap around the 
        <span>exclusion areas</span> in their associated <span>wrapping context</span>. If the element is itself an exclusion, it 
        does not wrap around its own exclusion shape and the impact of other exclusions on other 
        exclusions is controlled by the 'z-index' property as explained in the 
        <a href="#exclusions-order">exclusions order</a> section.
    </p>
        The <a href="#shapes">shape properties</a> can be used to change the shape of 
        <span>exclusion areas</span>.
    </p>

    <h3 id="declaring-exclusions">Declaring exclusions</h3>
    <p>
        An element becomes an exclusion when its 'wrap-flow' property has a computed value other than 
        'auto'.
    </p>
    
    <h4 id="wrap-flow-property">The 'wrap-flow' property</h4>
    <table class="propdef">
        <tr>
            <th>Name:</th>
            <td><dfn title="'wrap-flow'">wrap-flow</dfn></td>
        </tr>
        <tr>
            <th>Value:</th>
            <td><var>auto</var> | <var>both</var> | <var>start</var> | <var>end</var> | <var>minimum</var> | <var>maximum</var> | <var>clear</var></td>
        </tr>
        <tr>
            <th>Initial:</th>
            <td>auto</td>
        </tr>
        <tr>
            <th>Applies to:</th>
            <td>block-level elements.</td>
        </tr>
        <tr>
            <th>Inherited:</th>
            <td>no</td>
        </tr>
        <tr>
            <th>Percentages:</th>
            <td>N/A</td>
        </tr>
        <tr>
            <th>Computed&nbsp;value:</th>
            <td>as specified except for element's whose 'float' computed  value is not
                <code class="css">none</code>, in which case the computed value is 'auto'.</td>
        </tr>
    </table>

    <p>The values of this property have the following meanings:</p>
    <dl>
        <dt><dfn title="'wrap-flow'!!'auto'">auto</dfn></dt>
        <dd>
            No exclusion is created. Inline flow content interacts with the element as usual.
            In particular, if the element is a 
            <a href="https://www.w3.org/TR/CSS2/visuren.html#floats">float</a> (see [[CSS21]]), the 
            behavior is unchanged.
        </dd>
        <dt><dfn title="'wrap-flow'!!'both'">both</dfn></dt>
        <dd>
            Inline flow content can flow on all sides of the exclusion.
        </dd>
        <dt><dfn title="'wrap-flow'!!'start'">start</dfn></dt>
        <dd>
            Inline flow content can flow 
            around the start edge 
            of the <span>exclusion area</span> 
            but must leave the area 
            next to the end edge 
            of the exclusion empty.
        </dd>
        <dt><dfn title="'wrap-flow'!!'end'">end</dfn></dt>
        <dd>
            Inline flow content can flow 
            around the end edge 
            of the <span>exclusion area</span> 
            but must leave the area 
            next to the start edge 
            of the exclusion empty.
        </dd>
        <dt><dfn title="'wrap-flow'!!'minimum'">minimum</dfn></dt>
        <dd>
            Inline flow content can flow 
            around the edge of the exclusion 
            with the smallest available space 
            within the flow content's containing block, 
            and must leave the other edge
            of the exclusion empty.
        </dd>
        <dt><dfn title="'wrap-flow'!!'maximum'">maximum</dfn></dt>
        <dd>
            Inline flow content can flow 
            around the edge of the exclusion 
            with the largest available space 
            within the flow content's containing block, 
            and must leave the other edge
            of the exclusion empty.
        </dd>
        <dt><dfn title="'wrap-flow'!!'clear'">clear</dfn></dt>
        <dd>
            Inline flow content can only flow 
            before and after the exclusion 
            in the flow content's block direction 
            and must leave the areas 
            next to the start and end edges 
            of the exclusion empty.
        </dd>
    </dl>

    <p>
        If the property's computed value is 'auto', the element does not become an 
        <span>exclusion</span>.
    </p>
    <p>
        Otherwise, a computed 'wrap-flow' property value of 'both', 'start', 'end', 'minimum', 
        'maximum' or 'clear' on an  element makes that element an <span>exclusion element</a>. 
        It's <span>exclusion shape</span> is contributed to its containing block's 
        <span>wrapping context</span>, causing the containing block's descendants to wrap around 
        its <span>exclusion area</span>.
    </p>

    <div class="figure">
        <img alt="LTR text wrapping on left edge, RTL text wrapping on right edge, and vertical text wrapping on top edge." src="images/exclusion-writing-modes.png" width="70%" />
        <p class="caption">Exclusion with 'wrap-flow: start' interacting with various writing modes.</p>
    </div>

    <p>Determining the relevant edges of the exclusion depends on the <a href="https://www.w3.org/TR/css3-writing-modes/#text-flow">writing mode</a> [[!CSS3-WRITING-MODES]] of the content wrapping around the <span>exclusion area</span>.
    
    <p>An <span>exclusion element</span> establishes a 
        new <a href="">block formatting context</a> (see [[!CSS21]]) for its content.</p>

    <div class="figure">
        <img alt="General illustration showing how exclusions combine" src="images/exclusions-illustration.png" width="70%" />
        <p class="caption">Combining exclusions</p>
    </div>
    
    <p>
        The above figure illustrates how exclusions are combined. 
        The outermost box represents an element's content box. 
        The A, B, C and D darker gray boxes represent exclusions 
        in the element's <span>wrapping context</span>. 
        A, B, C and D have their respective 'wrap-flow' 
        computed to 'both', 'start', 'end' and 'clear' respectively. 
        The lighter gray areas show the additional areas 
        that are excluded for inline layout 
        as a result of the 'wrap-flow' value. 
        For example, the area to the right of 'B' 
        cannot be used for inline layout 
        of left-to-right writing mode content 
        because the 'wrap-flow' for 'B' is 'start'.
    </p>
    <p>
        The background 'blue' area shows what areas are available 
        for a left-to-right writing mode element's inline content layout. 
        All areas represented with a light or dark shade of gray 
        are not available for (left-to-right writing mode) inline content layout.
    </p>
    
<div class="issue-marker wrapper">
    <div class="issue-marker" data-bug_id="15084" data-bug_status="NEW">
        <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15084">Issue-15084</a>
        <div class="issue-details">
            <p class="short-desc">Fluidity of the layout with respect to different amounts of content</p>
        </div>
    </div>
</div>

    <div class="example">
        <p>
            The 'wrap-flow' property values applied to exclusions as grid items.
        </p>
<code class="html"><pre>
    
&lt;div id="grid"&gt;
    &lt;div id="top-right" class="exclusion"&gt;&lt;/div&gt;
    &lt;div id="bottom-left" class="exclusion"&gt;&lt;/div&gt;
    &lt;div id="content"&gt;Lorem ipsum…&lt;/div&gt;
&lt;/div&gt;

&lt;style type="text/css"&gt; 
#grid {
    width: 30em;
    height: 30em;
    display: grid;
    grid-columns: 25% 25% 25% 25%;
    grid-rows: 25% 25% 25% 25%;

#top-right {
    grid-column: 3;
    grid-row: 2;
}

#bottom-left {
    grid-column: 2;
    grid-row: 3;
}

.exclusion {
    wrap-flow: &lt;see below&gt;
}

#content {
    grid-row: 1;
    grid-row-span: 4;
    grid-column: 1;
    grid-column-span: 4;
}
&lt;/style&gt; 
</pre></code>
        <p>The following figures illustrate the visual rendering for different values
            of the 'wrap-flow' property. The gray grid lines are marking the grid cells. and the 
            blue area is the exclusion box (positioned by the grid).</p>
        <table class="example-table">
            <tr>
                <td><code class="html">.exclusion{ wrap-flow: auto; }</code></td>
                <td><code class="html">.exclusion{ wrap-flow: both; }</code></td>
            </tr>
            <tr>
                <td><img src="images/exclusion_wrap_side_auto.png" alt="Example rendering for wrap-side: auto" /></td>
                <td><img src="images/exclusion_wrap_side_both.png" alt="Example rendering for wrap-side: both" /></td>
            </tr>
            <tr>
                <td><code class="html">.exclusion{ wrap-flow: start; }</code></td>
                <td><code class="html">.exclusion{ wrap-flow: end; }</code></td>
            </tr>
            <tr>
                <td><img src="images/exclusion_wrap_side_left.png" alt="Example rendering for wrap-side: start" /></td>
                <td><img src="images/exclusion_wrap_side_right.png" alt="Example rendering for wrap-side: end" /></td>
            </tr>
            <tr>
                <td><code class="html">.exclusion{ wrap-flow: minimum; }</code></td>
                <td><code class="html">.exclusion{ wrap-flow: maximum; }</code></td>
            </tr>
            <tr>
                <td><img src="images/exclusion_wrap_side_minimum.png" alt="Example rendering for wrap-side: minimum" /></td>
                <td><img src="images/exclusion_wrap_side_maximum.png" alt="Example rendering for wrap-side: maximum" /></td>
            </tr>
            <tr>
                <td><code class="html">.exclusion{ wrap-flow: clear; }</code></td>
                <td></td>
            </tr>
            <tr>
                <td><img src="images/exclusion_wrap_side_clear.png" alt="Example rendering for wrap-side: clear" /></td>
                <td></td>
            </tr>
        </table>
    </div>
    
    <!-- End section "wrap-flow Property" -->
    <!-- End section "Declaring Exclusions" -->
        
    <h3 id="scope-and-effect-of-exclusions">Scope and effect of exclusions</h3>
    <p>
        An <span>exclusion</span> affects 
        the inline flow content descended 
        from the exclusion's containing block 
        (defined in <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">
        CSS 2.1 10.1</a>) 
        and that of all descendant elements 
        of the same containing block. 
        All inline flow content 
        inside the containing block 
        of the exclusions is affected. 
        To stop the effect of exclusions 
        defined outside an element, 
        the 'wrap-through' property can be used 
        (see the <a href="#propagation-of-exclusions">propagation of exclusions</a>
        section below).
    </p>
    
    <p>
        As a reminder, 
        for exclusions with 'position:fixed', 
        the containing block is that 
        of the root element.
    </p>
        
    <!-- End section "Scope and Effect of Exclusions" -->
    
    <h3 id="propagation-of-exclusions">Propagation of Exclusions</h3>
    <p>
        By default, an element inherits its parent <span>wrapping context</span>. In other words
        it is subject to the exclusions defined <span title="outside-inside">outside</sapn> the element.
    </p>
    <p>Setting the 'wrap-through' property to 'none' prevents an element from inheriting its parent
        <span>wrapping context</span>. In other words, exclusions defined 'outside' the element, have not effect
        on the element's children layout.
    </p>
    <div class="note">
        Exclusions defined by an element's descendants still contribute to their containing block's
        <span>wrapping context</span>. If that containing block is a child of an element with 'wrap-through'
        computes to none, or the element itself, then exclusion still have an effect on the children of that 
        containing block element.
    </div>

    <h4 id="wrap-through-property">The 'wrap-through' Property</h4>
    
    <table class="propdef">
        <tr>
            <th>Name:</th>
            <td><dfn title="'wrap-through'">wrap-through</dfn></td>
        </tr>
        <tr>
            <th>Value:</th>
            <td><var>wrap</var> | <var>none</var></td>
        </tr>
        <tr>
            <th>Initial:</th>
            <td>wrap</td>
        </tr>
        <tr>
            <th>Applies to:</th>
            <td>block-level elements</td>
        </tr>
        <tr>
            <th>Inherited:</th>
            <td>no</td>
        </tr>
        <tr>
            <th>Percentages:</th>
            <td>N/A</td>
        </tr>
        <tr>
            <th>Computed&nbsp;value:</th>
            <td>as specified</td>
        </tr>
    </table>

    <p>The values of this property have the following meanings:</p>
    <dl>
        <dt><dfn title="'wrap-through'!!'wrap'">wrap</dfn></dt>
        <dd>
            The element inherits its parent node's <span>wrapping context</span>. Its descendant
            inline content wraps around exclusions defined <span title="outside-inside">outside</span>
            the element.
        </dd>
    </dl>
    <dl>
        <dt><dfn title="'wrap-through'!!'none'">none</dfn></dt>
        <dd>
            The element does not inherit its parent node's <span>wrapping context</span>. Its 
            descendants are only subject to exclusion shapes defined <span title="outside-inside">inside</span>
            the element.
        </dd>
    </dl>
    <div class="example">
        <p>
            Using the 'wrap-through' property to control the effect of exclusions.
        </p>
<pre><code class="html">

&lt;style type="text/css"&gt; 
    #grid {
        display: grid;
        grid-columns: 25% 50% 25%;
        grid-rows: 25% 25% 25% 25%;
    }

    #exclusion {
        grid-row: 2;
        grid-row-span: 2;
        grid-column: 2;
        wrap-flow: &lt;see below&gt;
    }
    
    #rowA, #rowB {
        grid-row-span: 2;
        grid-column: 1;
        grid-column-span: 3;
    }

    #rowA {
        grid-row: 1;
    }
    
    #rowB {
        grid-row: 3;
    }
    &lt;/style&gt;
        
&lt;style type="text/css"&gt; 
    .exclusion  {
    	wrap-flow: both; 
    	position: absolute; 
    	left: 20%;
    	top: 20%;
    	width: 50%;
    	height: 50%;
    	background-color: rgba(220, 230, 242, 0.5); 
    } 
&lt;/style&gt; 

&lt;div id="grid"&gt; 
    &lt;div class=”exclusion”&gt;&lt;/div&gt; 
    &lt;div id="rowA" style=”wrap-through: wrap;”&gt; Lorem ipsum dolor sit amet...&lt;/div&gt; 
    &lt;div id="rowB" style=”wrap-through: none;”&gt; Lorem ipsum dolor sit amet...&lt;/div&gt; 
&lt;/div&gt;
</code></pre>

        <img class="singleImgExample" src="images/exclusion_wrap_through.png" alt="Example rendering of wrap-through: wrap | none" style="max-width:40%"/>
    </div>
    <!-- End section "wrap-through property" -->

<!-- removed as wrap-margin and wrap-padding changed to shape-margin and shape-padding

    <h4 id="wrap-shorthand-property">The 'wrap' Shorthand Property</h4>
    <table class="propdef">
        <tr>
            <th>Name:</th>
            <td><dfn title="'wrap'">wrap</dfn></td>
        </tr>
        <tr>
            <th>Value:</th>
            <td><var>&lt;wrap-flow&gt;</var> || <var>&lt;wrap-margin&gt;</var> [ / <var>&lt;wrap-padding&gt;</var>]</td>
        </tr>
        <tr>
            <th>Initial:</th>
            <td>see individual properties</td>
        </tr>
        <tr>
            <th>Applies to:</th>
            <td>block-level elements</td>
        </tr>
        <tr>
            <th>Inherited:</th>
            <td>no</td>
        </tr>
        <tr>
            <th>Percentages:</th>
            <td>N/A</td>
        </tr>
        <tr>
            <th>Computed&nbsp;value:</th>
            <td>see individual properties</td>
        </tr>
    </table>
    <p>
        The 'wrap' property is a shorthand property for setting the exclusions properties
        at the same place in the style sheet.
    </p>
-->
    <!-- End section "wrap shorthand property" -->
    <!-- End section "Propagation of Exclusions" -->
    
    <h3 id="exclusions-order">Exclusions order</h3>
    <p>
        Exclusions follow the painting order (See [[!CSS21]] Appendix E). Exclusions are
        applied in reverse to the document order in which they are defined. The last exclusion
        appears on top of all other exclusion, thus it affects the inline flow content of
        all other preceding exclusions or elements descendant of the same containing block.
        The 'z-index' property can be used to change the ordering of 
        <a href="https://www.w3.org/TR/CSS2/visuren.html#choose-position">positioned</a> exclusion
        boxes (see [[!CSS21]]). Statically positioned exclusions are not affected by the 
        'z-index' property and thus follow the painting order.
    </p>

    <div class="issue-marker" data-bug_id="16474" data-bug_status="NEW">
      <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16474">Issue-16474</a>
      <div class="issue-details">
          <p class="short-desc">Improve Example 3 about exclusion order</p>
      </div>  
    </div>

    <div class="example">
        <p>Ordering of exclusions.</p>
<pre><code class="html">
&lt;style type="text/css"&gt; 
    .exclusion  {
    	wrap-flow: both; 
    	position: absolute; 
    	width: 50%; 
    	height: auto; 
    } 
&lt;/style&gt; 

&lt;div class=”exclusion” style=”top: 0px; left: 0px;”&gt; 
    Lorem ipsum dolor sit amet... 
&lt;/div&gt; 
&lt;div id="orderedExclusion" class=”exclusion” style=”top: 25%; left: 25%;”&gt; 
    Lorem ipsum dolor sit amet... 
&lt;/div&gt; 
&lt;div class=”exclusion” style=”top: 50%; left: 50%;”&gt; 
    Lorem ipsum dolor sit amet... 
&lt;/div&gt;
</code></pre>

    <table class="example-table">
        <tr>
            <td style="width:50%"><code class="html">#orderedExclusion{ z-index: auto; }</code></td>
            <td style="width:50%"><code class="html">#orderedExclusion{ z-index: 1; }</code></td>
        </tr>
        <tr>
            <td><img class="singleImgExample" src="images/exclusion_ordering.png" alt="Example rendering of default exclusion ordering." /></td>
            <td><img class="singleImgExample" src="images/exclusion_ordering_z_order.png" alt="Example rendering of default exclusion ordering." /></td>
        </tr>
    </table>

    </div>
    <!-- End section "Order of Exclusions" -->
        
    <div class="issue-marker wrapper">
    <div class="issue-marker" data-bug_id="15183" data-bug_status="NEW">
        <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15183">Issue-15183</a>
        <div class="issue-details">
            <p class="short-desc">Is the CSS exclusions processing model incorrect?</p>
        </div>
    </div>
    </div>

    <div class="issue">

        <p>The current draft provides a model for exclusions
        without a collision-avoidance model. 
        The existing exclusion model in CSS uses floats, 
        which have both exclusion and collision-avoidance behavior. 
        Concerns have been raised that allowing exclusions 
        without collision avoidance could be harmful, 
        particularly with absolutely-positioned elements. 
        Three options should be considered:<p>
        <ol>
            <li>Allow exclusions in positioning schemes 
                with no collision avoidance.</li>
            <li>Disallow exclusions in positioning schemes 
                with no collision avoidance.</li>
            <li>Define collision-avoidance behavior 
                for positioning schemes without it, 
                and use this behavior by default with exclusions.</li>
        </ol>
    </div>
    
        <h3 id="exclusions-processing-model">Processing model</h3>
        
        <h4 id="exclusions-processing-model-description">Description</h4>
        
        <p>Applying exclusions is a two-step process:</p>
        
        <ul>
            <li><strong>Step 1</strong>: resolve exclusion boxes belonging to each <span>wrapping context</span></li>
            <li><strong>Step 2</strong>: resolve <span>wrapping context</span>s and lay out each containing block in turn:
                <ul>
                    <li><strong>Step 2-A</strong>: resolve the position and size of exclusion boxes</li>
                    <li><strong>Step 2-B</strong>: lay out containing block, wrapping around <span>exclusion areas</span></li>
                </ul>
                </li>
        </ul>
        
        <h4 id="step-1-resolve-exclusion-boxes-belonging-to-each-wrapping-context">Step 1: resolve exclusion boxes belonging to each <span>wrapping context</span></h4>
        
        <p>In this step, the user agent determines which <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block</a> each 
            <span>exclusion area</span> belongs to. This is a simple step, based on the 
            definition of containing blocks and elements with a computed value for 'wrap-flow'
            that is not <code class="css">auto</code>.</p>
        
        <h4 id="step-2-resolve-wrapping-contexts-layout-containing-blocks">Step 2: resolve wrapping contexts and lay out containing blocks</h4>

        <p>In this step, starting from the 
            top of the <a href="https://www.w3.org/TR/CSS2/visuren.html#z-index">rendering tree</a> (see [[!CSS21]]), 
            the agent processes each containing block in two sub-steps.</p>
        
        <h4 id="step-2-A-resolve-exclusions-position-and-size">Step 2-A: resolve the position and size of exclusion boxes</h4>
        
        <p>Resolving the position and size 
            of <span>exclusion boxes</span> 
            in the <span>wrapping context</span> 
            may or may not require a layout. 
            For example, 
            if an <span>exclusion box</span> 
            is absolutely positioned and sized,
            a layout may not be needed 
            to resolve its position and size. 
            In other situations, 
            laying out the containing block's content is required.</p>
            
        <p>When a layout is required, 
            it is carried out
            without applying any <span>exclusion area</span>.
            In other words, 
            the containing block is laid out
            without a <span>wrapping context</span>. </p>
            
        <p>Step 2-A yields a position and size
            for all <span>exclusion boxes</span> 
            in the <span>wrapping context</span>. 
            Each exclusion box is processed in turn, 
            starting from the top-most, 
            and each <span>exclusion area</span> 
            is computed and contributed 
            to the <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a> 
            <span>wrapping context</span>. </p>
            
        <p>Scrolling is ignored in this step 
            when resolving the position and size 
            of 'position:fixed' <span>exclusion boxes</span>.</p>

        <p>Once the <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a>
            <span>wrapping context</span> is computed, 
            all <span>exclusion boxes</span> 
            in that <span>wrapping context</span> 
            are removed from the normal flow.</p>

        <h4 id="step-2-B-layout-containing-block-applying-wrapping">Step 2-B: lay out containing block applying wrapping</h4>
            
        <p>Finally, the content 
            of the containing block is laid out, 
            with the inline content wrapping around 
            the <span>wrapping content</span>'s
            <span>exclusion areas</span> 
            (which may be different 
            from the <span>exclusion box</span>
            because of the 'shape-outside' property).</p>
            
        <p>When the containing block itself is an <span>exclusion box</span>, then 
            rules on <a href="#exclusions-order">exclusions order</a> define which exclusions
            affect the inline and descendant content of the box.</p>
            
        <h4 id="exclusions-processing-model-example">Example</h4>

        <p>This section illustrates the exclusions processing model with an example. It is meant 
            to be simple. Yet, it contains enough complexity to address the issues of 
            layout dependencies and re-layout.</p>


        <p>The code snippet in the following example has two exclusions affecting 
            the document's inline content.</p>

        <div class="example">
        <pre class="html">&lt;html&gt;
&lt;style&gt;
#d1 {
    position:relative;
    height: auto;
    color: #46A4E9;
    border: 1px solid gray;
}

#e1 {
    wrap-flow: both;
    position: absolute; 
    left: 50%; 
    top: 50%; 
    width: 40%; 
    height: 40%; 
    border: 1px solid red;
    margin-left: -20%;
    margin-top: -20%;
}

#d2 {
    position: static;
    width: 100%;
    height: auto;
    color: #808080;
}

#e2 {
    wrap-flow: both;
    position: absolute; 
    right: 5ex; 
    top: 1em; 
    width: 12ex;
    height: 10em; 
    border: 1px solid lime;
}
&lt;/style&gt;
&lt;body&gt;
    &lt;div id="d1"&gt;
        Lorem ipsusm ...
        &lt;p id="e1"&gt;&lt/p&gt;
    &lt;/div&gt;
    &lt;div id="d2"&gt;
        Lorem ipsusm ...
        &lt;p id="e2" &gt;&lt/p&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
        </div>
        <p>The following figures illustrate:</p>
        
        <ul>
            <li>the document's DOM tree</li>
            <li>the layout tree of generated block boxes</p>
        </ul>
        
        <div class="figure">
            <img src="images/processing-model-example-dom.svg" width="200" 
                alt="DOM tree nodes"/>
            <p class="caption">DOM tree</p>
        </div>

        <div class="figure">
            <img src="images/processing-model-example-layout-tree.svg" width="350" 
                alt="Layout tree boxes"/>
            <p class="caption">Layout tree of generated block boxes</p>
        </div>

        <h5>Step 1: resolve exclusion boxes belonging to each <span>wrapping context</span></h5>
        
        <p>The figures illustrate how the boxes corresponding to the element sometimes
            have a different containment hierarchy in the layout tree than in the DOM tree. 
            For example, the box generated by <code class="idl">e1</code> is positioned in
            its containing block's box, which is the <code class="idl">d1-box</code>, because 
            <code class="idl">e1</code> is absolutely positioned and <code class="idl">d1</code>
            is relatively positioned. However, while <code class="idl">e2</code> is also absolutely 
            positioned, its containing block is the initial containing block (ICB). See the 
            section 10.1 of the CSS 2.1 specification ([[!CSS21]]) for details.</p>

        <p>As a result of the computation of containing blocks for the tree, the boxes belonging 
            to the <span>wrapping context</span>s of all the elements can be determined:</p>

        <ul>
            <li>The <span>wrapping context</span> for the html element contains the <code class="idl">e2</code> box: WC-1 (Wrapping Context 1)</li>
            <li>The <span>wrapping context</span> for the body element inherits the html element's <span>wrapping context</span>: WC-1</li>
            <li>The <span>wrapping context</span> for <code class="idl">d1</code> inherits the body element's 
                <span>wrapping context</span> and adds the <code class="idl">e1-box</code> to it. So the wrapping
                context is made of both the <code class="idl">e1-box</code> and the 
                <code class="idl">e2-box</code>: WC-2</li>
            <li>The <span>wrapping context</span> for <code class="idl">d2</code> inherits the body element's 
                <span>wrapping context</span>: WC-1</li>
        </ul>

        <h5>Step 2: resolve wrapping contexts and lay out containing blocks</h5>
        
        <p>In this step, each containing block is processed in turn. For each containing block,
            we (conceptually) go through two phases:</p>
        <ol>
            <li>resolve the <span>wrapping context</span>: resolve the position and size of its exclusions</li>
            <li>lay out the containing block</li>
        </ol>
            
        <p>In our example, this breaks down to:</p>
        <ol>
            <li>resolve the position and size of the exclusions belonging to WC-1: RWC-1 (Resolved Wrapping Context 1).</li>
            <li>lay out the initial containing block (i.e., lay out its content):
                <ol>
                    <li>resolve the html element's <span>wrapping context</span>: RWC-1</li>
                    <li>lay out the html element:
                        <ol>
                            <li>resolve the body element's <span>wrapping context</span>: RWC-1</li>
                            <li>lay out the body element:
                                <ol>
                                    <li>resolve the <code class="idl">d1</code> element's <span>wrapping context</span>: RWC-2</li>
                                    <li>lay out the <code class="idl">d1</code> element</li>
                                    <li>resolve the <code class="idl">d2</code> element's <span>wrapping context</span>: RWC-1</li>
                                    <li>lay out the <code class="idl">d2</code> element</li>
                                </ol>
                            </li>
                        </ol>
                    </li>
                </ol>
                </li>
        </ol>
        
        <h6>Resolving RWC-1</h6>
        
        <p>The top-most <span>wrapping context</span> in the layout tree contains the <code class="idl">e2</code>
            exclusion. Its position and size needs to be resolved. In general, computing an 
            exclusion's position and size may or may not require laying out other content.
            In our example, no content needs to be laid out to resolve the <code class="idl">e2</code>
            exclusion's position because it is absolutely positioned and its size can be resolved
            without layout either. At this point, RWC-1 is resolved and can be used when
            laying inline content out.</p>

        <h6>Resolving RWC-2</h6>
        
        <p>The process is similar: the position of the 
            <code class="idl">e1</code> exclusion needs to be resolved. Again, resolving the exclusion's 
            position and size may require processing the containing block (d1 here). 
            It is the case here because the size and position of
            <code class="idl">e1</code> depend on resolving the percentage lengths. The percentages are relative 
            to the size of 
            <code class="idl">d1</code>'s box. As a result, in order to resolve
            a size for <code class="idl">d1</code>'s box, a first layout of <code class="idl">d1</code>
            is done without any <span>wrapping context</span> (i.e., no exclusions applied). The layout yields a 
            position and size for <code class="idl">e1</code>'s box. 
        </p>
        <p>At this point, RWC-2 is resolved because the position and size of both 
            e1 and e2 are resolved.</p>

        <p class="note">The important aspect of the above processing example is that once an element's <span>wrapping context</span>
            is resolved (by resolving its exclusions' position and size), the position and size of the
            exclusions are not re-processed if the element's size changes between the layout that may be done 
            without considering any <span>wrapping context</span> (as for RWC-2) and the layout done with the resolved <span>wrapping context</span>. 
            This is what breaks the possible circular dependency between the resolution of <span>wrapping context</span>s
            and the layout of containing blocks.</p>
    
    <h3 id="floats-and-exclusions">Floats and exclusions</h3>
    
    <h4 id="floats-and-exclusions-similarities">Similarities</h4>
    
    <p>There are similarities between floats and exclusions in that inline content wraps around floats 
        and also wraps around <span>exclusion areas</span>. However, there are very significant differences.</p>
        
    <h4 id="floats-and-exclusions-differences">Differences</h4>
    
    <ul>
        <li><strong>scope</strong>. While floats apply to content that follows in the 
            document, exclusions apply to content in their containing block.</li>
        <li><strong>positioning</strong>. Floats are part of the inline flow and 'float' on the
            line box. Authors can control how the floats move on the line box, to the right or to the
            left. By contrast, exclusions can be positioned using any positioning scheme such
            as grid layout ([[CSS3-GRID-LAYOUT]]), flexible box ([[CSS3-FLEXBOX]]) or any other
            CSS positioning scheme.</li>
        <li><strong>separation of concerns</strong>. Making an element a float determines both
            its positioning scheme and its effect on inline content. Making an element an
            exclusion only determines its impact on inline content and does not impose constraints 
            on its positioning method.</li>
    </ul>
    
    <h4 id="floats-and-exclusions-interoperability">Interoperability</h4>
    
    <h5 id="effect-of-floats-on-exclusions">Effect of floats on exclusions</h5>
    
    <p>Floats have an effect on the positioning of exclusions and the layout of their inline content. For 
        example, if an exclusion is an inline-box which happens to be on the same line as a float,
        its' position, as computed in <a href="#step-2-A-resolve-exclusions-position-and-size">Step 2-A</a> will be impacted by the float, as 
        is any other inline content.</p>
    
    <h5 id="effect-of-exclusions-on-floats">Effect of exclusions on floats</h5>
    
    <p>Exclusions have an effect on the positioning of floats as they have an effect on inline content. 
        Therefore, in <a href="#step-2-B-layout-containing-block-applying-wrapping">Step 2-B</a>, floats will avoid <span>exclusion areas</span>.</p>

    <!-- End section "Exclusions" -->

    <h2 id="shapes">Shapes</h2>

<div class="issue-marker wrapper">
    <div class="issue-marker" data-bug_id="15091" data-bug_status="NEW">
        <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15091">Issue-15091</a><br />
        <div class="issue-details">
            <p class="short-desc">Simplify the syntax for shapes</p>
        </div>
    </div>

    <div class="issue-marker" data-bug_id="16716" data-bug_status="NEW">
      <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16716">Issue-16716</a>
      <div class="issue-details">
          <p class="short-desc">Handling visible content as a shape for Exclusions</p>
      </div>  
    </div>
</div>

    <p>
        Shapes define arbitrary geometric contours around which or into which inline flow
        content flows. There are two different types of shapes – 'outside' and 'inside'.
        The outside shape defines the <span>exclusion area</span> for an <span>exclusion element</span>
        or the <span>float area</span> for a float. 
        The inside shape defines an element's <span>content shape</span> and the element's inline 
        content will flow within that shape.
    </p>
    
    <p class="note">It is important to note that while outside shapes only apply to 
        <span>exclusions</span> and floats, inside shapes apply to all block-level elements.</p>

    <h3 id="relation-to-box-model-and-float-behavior">Relation to the box model and float behavior</h3>
    
    <p>
        While the boundaries used for wrapping inline flow content outside and inside
        an element can be defined using shapes, the actual box model does not change. If
        the element has specified margins, borders or paddings they will be computed and
        rendered according to the [[!CSS3BOX]] module.
    </p>
    
    <p>
        However, floats are an exception. If a float has an outside shape, its positioning 
        is resolved as
        <a href="https://www.w3.org/TR/CSS2/visuren.html#float-position">defined</a> in 
        [[!CSS21]] but using the
        outside shape's bounding box is used in lieu of the float's margin box. 
    </p>
    
    <div class="example">
        <p>CSS 'shape-outside' and CSS box model relation: the red box illustrates the exclusion element's
            content box, which is unmodified and subject to normal CSS positioning (here absolute positioning).</p>
<pre><code class="html">
&lt;style type="text/css"&gt; 
    .exclusion  {
    	wrap-flow: both; 
    	position: absolute; 
    	top: 25%;
    	left: 25%;
    	width: 50%;
    	height: 50%;
    	shape-outside: circle(50%, 50%, 50%); 
    	border: 1px solid red; 
    } 
&lt;/style&gt; 

&lt;div style=”position: relative;”&gt; 
    &lt;div class=”exclusion”&gt;&lt;/div&gt; 
    Lorem ipsum dolor sit amet... 
&lt;/div&gt;
</code></pre>
        <img class="singleImgExample" src="images/shapes_CSS2.1_MBP.png" alt="Example rendering of circle shape and box model."  style="max-width:40%"/>
    </div>
    
      <div class="example">
          <p>In the following example the left and right floating <code class="html">div</code> elements 
              specify a triangular shape using the 'shape-outside' property.</p>

<pre><code class="html">
&lt;div style="text-align:center;"&gt;
      &lt;div id="float-left"&gt;&lt;/div&gt;
      &lt;div id="float-right"&gt;&lt;/div&gt;
      &lt;div&gt;
      Sometimes a web page's text content appears to be
      funneling your attention towards a spot on the page
      to drive you to follow a particular link.  Sometimes
      you don't notice.
      &lt;/div&gt;
&lt;/div&gt;

&lt;style type="text/css"&gt;
#float-left {
      shape-outside: polygon(0,0 100%,100% 0,100%);
      float: left;
      width: 40%;
      height: 12ex;
  }

#float-right {
      shape-outside: polygon(100%,0 100%,100% 0,100%);
      float: right;
      width: 40%;
      height: 12ex;
  }
  &lt;/style&gt;
&lt;/div&gt;</code></pre>
      
        <img class="singleImgExample" src="images/float-shape-outside.png" alt="Using the shape-outside property with a float"/>
      </div>
      <h3 id="basic-shapes-from-svg-syntax">Basic Shapes</h3>
      <p>
          Shapes can be specified using 
          syntax similar to SVG's <a href="https://www.w3.org/TR/SVG/shapes.html">basic shapes</a>. 
          The definitions use 
          <code><a href="https://www.w3.org/TR/css3-values/#lengths">&lt;length&gt;</a></code> type 
          and the <code><a href="">&lt;percentage&gt;</a></code> types (see [[!CSS3VAL]]). 
          Percentages are resolved 
          from the computed value of the 
          <a href="https://www.w3.org/TR/css3-ui/#box-sizing">'box-sizing'</a>
          property [[!CSS3UI]] 
          on the element to which the property applies. 
          For the radius <code>r</code> of the <code>circle</code> shape, 
          a percentage value is resolved as
          <a href="https://www.w3.org/TR/SVG/coords.html#Units">specified</a> 
          in the SVG recommendation (see [[!SVG11]]). 
          Path styling like stroking is not considered part of the specified shape.
      </p>
      
       
      <h4 id="supported-basic-shapes">Supported Shapes</h4>
      The following basic shapes are supported.
      <dl>
          <dt><dfn id="rectangle">rectangle</dfn>([&lt;length&gt;|&lt;percentage&gt;]{4} [ curve [&lt;length&gt;|&lt;percentage&gt;]{1,2} ]? )</dt>
          <dd>
              <ul>
                  <li>
                      The four values represent 
                      <strong>x, y, width</strong> and 
                      <strong>height</strong>.
                      They define the bounding box 
                      of the rectangle. 
                      Negative values for width and height are invalid.
                  </li>
                  <li>
                      The two 'curve' values represent 
                      <strong> rx</strong> and <strong>ry</strong>. 
                      For rounded rectangles they define 
                      the x-axis radius and y-axis radius 
                      of the ellipse used to round off 
                      the corners of the rectangle. 
                      Negative values for rx and ry are invalid.
                  </li>
              </ul>
          </dd>
          <dt><dfn id="inset-rectangle">inset-rectangle</dfn>([&lt;length&gt;|&lt;percentage&gt;]{4} [ curve [&lt;length&gt;|&lt;percentage&gt;]{1,2} ]? )</dt>
          <dd>
              <ul>
                  <li>
                      The four values represent the 
                      <strong>top, right, bottom</strong> and 
                      <strong>left</strong> insets that 
                      define the bounding box 
                      of the inset rectangle. 
                      Negative values for any of these insets are invalid.
                  </li>
                  <li>
                      The two 'curve' values represent 
                      <strong> rx</strong> and <strong>ry</strong>. 
                      For rounded inset rectangles they define 
                      the x-axis radius and y-axis radius 
                      of the ellipse used to round off 
                      the corners of the inset rectangle. 
                      Negative values for rx and ry are invalid.
                  </li>
              </ul>
          </dd>
          <dt><dfn id="circle">circle</dfn>([&lt;length&gt;|&lt;percentage&gt;]{3})</dt>
          <dd>
              <ul>
                  <li>
                      The three values represent 
                      <strong>cx</strong>, 
                      <strong>cy</strong>, 
                      and <strong>r</strong>. 
                      They define the x-axis and y-axis coordinates
                      of the center of the circle 
                      and the radius of the circle. 
                      A negative value for r is invalid.
                  </li>
              </ul>
          </dd>
          <dt><dfn id="ellipse">ellipse</dfn>([&lt;length&gt;|&lt;percentage&gt;]{4})</dt>
          <dd>
              <ul>
                  <li>
                      The four values represent 
                      <strong>cx</strong>, 
                      <strong>cy</strong>, 
                      <strong>rx</strong>, and 
                      <strong>ry</strong>.  
                      They define the x-axis and y-axis coordinates
                      of the center of the ellipse 
                      and the x-axis and y-axis radius
                      of the ellipse. 
                      Negative values for rx and ry are invalid.
                  </li>
              </ul>
          </dd>
          <dt><dfn id="polygon">polygon</dfn>([&lt;fill-rule&gt;,]? [&lt;length&gt;|&lt;percentage&gt;]{2}#)</dt>
          <dd>
              <ul>
                  <li><strong>fill-rule</strong> - The filling rule used to determine the interior of the
                      polygon. See <a href="https://www.w3.org/TR/SVG/painting.html#FillRuleProperty">fill-rule</a> property in SVG for details. Possible values are nonzero
                      or evenodd. Default value when omitted is nonzero.</li>
                  <li>
                      The two length values represent <strong>xi</strong> and <strong>yi</strong> - 
                      the <strong>x</strong> and <strong>y</strong> axis coordinates of the i-th vertex of the polygon.
                  </li>
              </ul>
              <p>The UA will close a polygon 
                by connecting the last vertex 
                with the first vertex of the list.</p>
              <br/>
          </dd>
      </dl>
      
      <h4 id='referencing-svg-shapes'>Referencing SVG shapes</h4>
      
      <p>An SVG shape can be referenced using the <code>url()</code> syntax. The shape can be 
          any of the <a href="https://www.w3.org/TR/SVG/shapes.html">SVG basic shapes</a> or a 
          <a href="https://www.w3.org/TR/SVG/paths.html">path element</a>.</p>
                
      <div class="example">
          <div style="float:right">
            <img alt="results of referencing SVG shapes" src="images/svg-shape-reference.png">
          </div>
          <code class="html"><pre>
&lt;style&gt;
div {
    height: 400px;
    width: 400px;
}
.in-a-circle {
    shape-inside: url(#circle_shape);
}

.in-a-path {
    shape-inside: url(#path-shape);
}

&lt;/style&gt;

&lt;svg ...&gt;
&lt;circle id="circle_shape" cx="50%" cy="50%" r="50%" /&gt;
&lt;path id="path-shape" d="M 100 100 L 300 100 L 200 300 z" /&gt;
&lt;/svg&gt;

&lt;div class="in-a-circle"&gt;...&lt;/div&gt;
&lt;div class="in-a-path"&gt;...&lt;/div&gt;
          </pre></code>
      </div>
        <p>
            When using the SVG syntax 
            or referencing SVG elements 
            to define shapes, 
            the relevant box is determined 
            by the computed value of the 
            <a href="https://www.w3.org/TR/css3-ui/#box-sizing">'box-sizing'</a>
            property. 
            All the lengths expressed in percentages 
            are resolved from the relevant box. 
            The coordinate system for the shape 
            has its origin on the top-left corner of the
            relevant box with the x-axis 
            running to the right 
            and the y-axis running downwards.
            If the SVG element uses unitless coordinate values, 
            they are equivalent to using
            'px' units. 
            If the relevant box of the element 
            is dependent on auto sizing 
            (i.e., the element's 'width' or 'height' property is 'auto'), 
            then the percentage values
            resolve to 0.
        </p>

      <h4 id='basic-shape-interpolation'>Interpolation of Basic Shapes</h4>

        <p>For interpolating between 
            one basic shape and a second, 
            the rules described below are applied. 
        </p>
        <ul>
            <li>If both basic shapes are of the same type and not of type polygon:
                <ul><li>Interpolate between each value.</li></ul>
            </li>
            <li>If one basic shape is of type rectangle and the second of type circle or ellipse:
                <ul><li>Replace the circle/ellipse with a temporary rectangle of equal dimension.</li>
                <li>Set the values for rx and ry on the temporary rectangle to ‘50%’.</li>
                <li>Interpolate between the two rectangles as above.</li></ul>
            </li>
            <li>If one basic shape is an inset-rectangle and the second is of type rectangle, circle or ellipse:
                <ul><li>Replace the inset-rectangle with a temporary rectangle of equal dimension.</li>
                <li>Interpolate between the basic shapes as above.</li></ul>
            <li>If both basic shapes are of type polygon and if both polygons have the same number of vertices:
                <ul><li>Interpolate between each value.</li></ul>
            </li>
            <li>In all other cases:
                <ul><li>No interpolation is specified.</li></ul></li>
            </ul>

        <!-- End section "Shapes from SVG Syntax -->
      
      <h3 id="shapes-from-image">Shapes from Image</h3>

   <div class="issue-marker wrapper">
      <div class="issue-marker" data-bug_id="15093" data-bug_status="NEW">
          <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15093">Issue-15093</a><br />
          <div class="issue-details">
              <p class="short-desc">Do we need to provide properties to repeat exclusion images as for the background-image property?</p>
          </div>
      </div>
      <div class="issue-marker" data-bug_id="15090" data-bug_status="NEW">
          <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15090">Issue-15090</a>
          <div class="issue-details">
              <p class="short-desc">Use the contour keyword in shape-outside property?</p>
          </div>  
      </div>
      <div class="issue-marker" data-bug_id="16112" data-bug_status="NEW">
      <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16112">Issue-16112</a>
      <div class="issue-details">
          <p class="short-desc">Address security concern with automatic shape extractions for images</p>
      </div>  
      </div>
    </div>
      
      <p>
          Another way of defining shapes is by specifying a source image whose alpha channel
          is used to compute the inside or outside shape. The shape is computed to be the
          path that encloses the area where the opacity of the specified image is greater
          than the 'shape-image-threshold' value. If the 'shape-image-threshold' is not specified,
          the initial value to be considered is 0.5.
      </p>
      
      <p class="note">
          Note, images can define cavities and inline flow content should wrap inside
          them. In order to avoid that, another exclusion element can be overlaid.
      </p>
      
      <p>For animated raster image formats (such as <a href="http://www.w3.org/Graphics/GIF/spec-gif89a.txt">GIF</a>), the first frame of the animation
          sequence is used. For <a href="https://www.w3.org/TR/2002/WD-SVG2Reqs-20020422/">SVG</a> images 
          ([[SVG11]]), the image is rendered without animations applied.</p>

      <div class="example">
        <p>An image is floating to the left of a paragraph. The image shows the 3D version of the
           CSS logo over a transparent background. The logo has a shadow using an alpha-channel.</p>
        <p>The image defines its <span>float area</span> through the 'shape-outside' property and
           specifies a value of 35 pixels for the 'shape-margin' property.</p>
           <pre><code class="html">
&lt;p&gt;
  &lt;img id="CSSlogo" src="CSS-logo1s.png"/&gt;
  blah blah blah blah...
&lt;/p&gt;

&lt;style&gt;
  #CSSlogo {
    float: left;
    shape-outside: url("CSS-logo1s.png");
    shape-image-threshold: 0.1;
    shape-margin: 35px;
  }
&lt;/style&gt;</code></pre>

       <p>The image needs two references to the image because this example uses the same image</p>
       <ol>
         <li>to render it</li>
         <li>as a shape defining the <span>float area</span> of the image</li>
       </ol>
       <p>It is perfectly possible to display an image and use a different image for its
          float area.</p>

       <p>In the figure below, the alpha-channel threshold is represented by the dotted line around
          the CSS logo and the 35px shape-margin is visible between that line and the edges of
          each individual line of the paragraph.</p>
       <p>It's then possible to affect where the lines of the paragraph start in three ways:</p>
       <ol>
         <li>Changing the value of the 'shape-margin' property</li>
         <li>Changing the value of the 'shape-image-threshold' property</li>
         <li>Modifying the alpha channel in the image</li>
       </ol>
        <div class='figure'>
            <img alt="A float shape around an image using its alpha-channel with a 35 pixels shape-margin" src="images/shape-outside-image.png" width="70%"/>
            <p class="caption">A float shape around an image using its alpha-channel with a 35 pixels shape-margin</p>
        </div>
      </div>
      <!-- End section "Shapes from image" -->

      <h3 id="declaring-shapes">Declaring Shapes</h3>
      <p>
          Shapes are declared with 
          the 'shape-outside' 
          or 'shape-inside' properties, 
          with possible modifications 
          from the 'shape-margin' 
          and 'shape-padding' properties. 
          The shape defined by 
          the 'shape-outside' 
          and 'shape-margin' properties 
          changes the geometry 
          of an <span>exclusion element</span>'s 
          <span>exclusion area</span> 
          or a float element's 
          <span>float area</span>. 
          If the element is not 
          an <span>exclusion element</span> 
          (see the 'wrap-flow' property) 
          or a float, 
          then the 'shape-outside' property 
          has no effect.
      </p>
      <p>
          The shape defined by the 'shape-inside' 
          and 'shape-padding' properties 
          defines an <span>exclusion area</span> 
          that contributes 
          to the element's <span>wrapping context</span>. 
          The 'shape-inside' property applies 
          to all block-level elements.
      </p>

      <h4 id="shape-outside-property">The 'shape-outside' Property</h4>

        <table class="propdef">
            <tr>
                <th>Name:</th>
                <td><dfn title="'shape-outside'">shape-outside</dfn></td>
            </tr>
            <tr>
                <th>Value:</th>
                <td><var>auto</var> | <var>&lt;basic-shape&gt;</var> | <var>&lt;uri&gt;</var></td>
            </tr>
            <tr>
                <th>Initial:</th>
                <td>auto</td>
            </tr>
            <tr>
                <th>Applies to:</th>
                <td>exclusion elements and floats</td>
            </tr>
            <tr>
                <th>Inherited:</th>
                <td>no</td>
            </tr>
            <tr>
                <th>Percentages:</th>
                <td>N/A</td>
            </tr>
            <tr>
                <th>Computed&nbsp;value:</th>
                <td>computed lengths for &lt;basic-shape&gt;, the absolute URI for &lt;uri&gt;, otherwise as specified</td>
            </tr>
        </table>
      
      <p>The values of this property have the following meanings:</p>
      <dl>
          <dt><dfn title="'shape-outside'!!'auto'">auto</dfn></dt>
          <dd>The shape is computed 
            based on the border box of the element for exclusions, 
            or computed based on the margin box for floats.</dd>
      </dl>
      <dl>
          <dt><dfn title="'shape-outside'!!'&lt;basic-shape&gt;'">&lt;basic-shape&gt;</dfn></dt>
          <dd>
              The shape is computed based on the values of one of 'rectangle', 'inset-rectangle', 'circle', 'ellipse'
              or 'polygon'.
          </dd>
      </dl>
      <dl>
          <dt><dfn title="'shape-outside'!!'&lt;uri&gt;'">&lt;uri&gt;</dfn></dt>
          <dd>
              If the &lt;uri&gt; references an SVG shape element, that element defines the shape.
              Otherwise, if the &lt;uri&gt; references an image, the shape is extracted and computed 
              based on the alpha channel of the specified image.
              
              If the &lt;uri&gt; does not reference an SVG shape element or an image, the 
              effect is as if the value 'auto' had been specified.
          </dd>
      </dl>
      
      <div class='figure'>
          <img alt="arbitrary shapes for exclusions. Illustrates how content flows around shapes" src="images/shapes-exclusions.png" width="70%"/>
          <p class="caption">Arbitrary shapes for exclusions</p>
      </div>
      
      <div>
          <p>The above figure shows how 
            'shape-outside' shapes 
            impact the <span>exclusion areas</span>. 
            The red box represents an element's content box 
            and 'A', 'B', 'C' and 'C' represent exclusions 
            with a complex shape 
            and their 'wrap-flow' property 
            computes to 'both', 'start', 'end' and 'clear', 
            respectively.</p>
              
          <p>As illustrated in the picture, 
            when an exclusion allows wrapping 
            on all sides, 
            text can flow inside 'holes' 
            in the exclusion 
            (as for exclusion 'A'). 
            Otherwise, the exclusion clears 
            the area on the side(s) 
            defined by 'wrap-flow', 
            as illustrated 
            for 'B', 'C' and 'D' above.</p>
      </div>
      <!-- End section "The shape-outside Property" -->

      <h4 id="shape-inside-property">The 'shape-inside' Property</h4>
      <p>
          The 'shape-inside' property adds 
          one or more exclusion areas 
          to the element's wrapping context. 
          This modifies the normal rectangular shape 
          of the content area 
          to a possibly non-rectangular wrapping area. 
          The exclusion areas  
          are defined by subtracting the shape 
          from the element's content area. 
          Any part of the shape outside 
          the element's content area 
          has no effect.
      </p>

      <table class="propdef">
          <tr>
              <th>Name:</th>
              <td><dfn title="'shape-inside'">shape-inside</dfn></td>
          </tr>
          <tr>
              <th>Value:</th>
              <td><var>outside-shape</var> | <var>auto</var> | <var>&lt;basic-shape&gt;</var> | <var>&lt;uri&gt;</var></td>
          </tr>
          <tr>
              <th>Initial:</th>
              <td>outside-shape</td>
          </tr>
          <tr>
              <th>Applies to:</th>
              <td>block-level elements</td>
          </tr>
          <tr>
              <th>Inherited:</th>
              <td>no</td>
          </tr>
          <tr>
              <th>Percentages:</th>
              <td>N/A</td>
          </tr>
          <tr>
              <th>Computed&nbsp;value:</th>
              <td>computed lengths for &lt;basic-shape&gt;, the absolute URI for &lt;uri&gt;, otherwise as specified</td>
          </tr>
      </table>

<div class="issue-marker wrapper">
    <div class="issue-marker" data-bug_id="16448" data-bug_status="ASSIGNED">
      <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16448">Issue-16448</a>
      <div class="issue-details">
          <p class="short-desc">Should we revisit the decision to not allow SVG path syntax in the shape-inside, shape-outside properties</p>
      </div>  
    </div>
</div>

    <p>The values of this property have the following meanings:</p>
    <dl>
        <dt><dfn title="'shape-inside'!!'outside-shape'">outside-shape</dfn></dt>
        <dd>
            The shape is computed 
            based on the computed value 
            of the 'shape-outside' property. 
            E.g., when shape-outside 
            computes to 'auto', 
            use the meaning of 'auto' below 
            to compute the shape.
        </dd>
    </dl>
    <dl>
        <dt><dfn title="'shape-inside'!!'auto'">auto</dfn></dt>
        <dd>
            The shape is computed based on the content box of the element.
        </dd>
    </dl>
    <dl>
        <dt><dfn title="'shape-inside'!!'&lt;basic-shape&gt;'">&lt;basic-shape&gt;</dfn></dt>
        <dd>
            The shape is computed based on the values of one of 'rectangle', 'inset-rectangle', 'circle', 'ellipse'
            or 'polygon'.
        </dd>
    </dl>
    <dl>
        <dt><dfn title="'shape-inside'!!'&lt;uri&gt;'">&lt;uri&gt;</dfn></dt>
        <dd>
            If the &lt;uri&gt; references an SVG shape element, that element defines the shape.
              Otherwise, if the &lt;uri&gt; references an image, the shape is extracted and computed 
              based on the alpha channel of the specified image.
          
              If the &lt;uri&gt; does not reference an SVG shape element or an image, the 
              effect is as if the value 'auto' had been specified.
        </dd>
    </dl>
    
    <p>The 'shape-inside' property applies to floats.</p>
    
    <p>The 'shape-inside' property may not apply on some elements such as elements with a 
        computed 'display' value of 'table'.</p>

    <div class='figure'>
        <img alt="Content flowing with and without a shape-inside" src="images/shape-inside-content.png"/>
        <p class="caption">Effect of shape-inside on inline content.</p>
    </div>

    <p>Overflow content avoids 
        the exclusion area(s) added 
        by 'shape-inside' and 'shape-padding' 
        (as well as any other exclusion areas 
        in the element's wrapping context).</p>

    <div class='figure'>
            <img alt="Overflow interacting with rounded rect" style="display:inline-block;vertical-align:top" src="images/rounded-rect-overflow.png"/>
            <img alt="Overflow interacting with ellipse" style="display:inline-block;vertical-align:top" src="images/ellipse-overflow.png"/>
        <p class="caption">Overflow interacting with exclusion areas defined by 'shape-inside' and 'shape-padding'.</p>
    </div>
        
    <!-- End section "The shape-inside property" -->
    <h4 id="shape-image-threshold-property">The 'shape-image-threshold' Property</h4>
    
    
    <p>
        The 'shape-image-threshold' defines the alpha channel threshold used to extract
        the shape using an image. A value of 0.5 means that all the pixels that are more
        than 50% transparent define the path of the exclusion shape. The 'shape-image-threshold'
        applies to both 'shape-outside' and 'shape-inside'.
    </p>
    <p class="note">
        The specified value of 'shape-image-threshold' is applied to both images used for
        'shape-outside' and 'shape-inside'.
    </p>

    <table class="propdef">
        <tr>
            <th>Name:</th>
            <td><dfn title="'shape-image-threshold'">shape-image-threshold</dfn></td>
        </tr>
        <tr>
            <th>Value:</th>
            <td><var>&lt;alphavalue&gt;</var></td>
        </tr>
        <tr>
            <th>Initial:</th>
            <td>0.5</td>
        </tr>
        <tr>
            <th>Applies to:</th>
            <td>block-level elements</td>
        </tr>
        <tr>
            <th>Inherited:</th>
            <td>no</td>
        </tr>
        <tr>
            <th>Percentages:</th>
            <td>alpha channel of the image specified by &lt;uri&gt;</td>
        </tr>
        <tr>
            <th>Computed&nbsp;value:</th>
            <td>The same as the specified value after clipping the &lt;alphavalue&gt; to the range [0.0,1.0].</td>
        </tr>
    </table>
    <p>The values of this property have the following meanings:</p>
    <dl>
        <dt><dfn title="'shape-image-threshold'!!'&lt;alphavalue&gt;'">&lt;alphavalue&gt;</dfn></dt>
        <dd>
            A &lt;number&gt; value used to set the threshold used for extracting a shape from
            an image. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque)
            will be clamped to this range.
        </dd>
    </dl>
    <!-- End section "The shape-image-threshold property" -->
    <!--
    <h4 id="shape-shorthand-property">The 'shape' Shorthand Property</h4>

    <table class="propdef">
        <tr>
            <th>Name:</th>
            <td><dfn title="'shape'">shape</dfn></td>
        </tr>
        <tr>
            <th>Value:</th>
            <td><var>&lt;shape-outside&gt;</var> [ / <var>&lt;shape-inside&gt;</var> ] || <var>&lt;shape-image-threshold&gt;</var></td>
        </tr>
        <tr>
            <th>Initial:</th>
            <td>see individual properties</td>
        </tr>
        <tr>
            <th>Applies to:</th>
            <td>block-level elements</td>
        </tr>
        <tr>
            <th>Inherited:</th>
            <td>no</td>
        </tr>
        <tr>
            <th>Percentages:</th>
            <td>N/A</td>
        </tr>
        <tr>
            <th>Computed&nbsp;value:</th>
            <td>see individual properties</td>
        </tr>
    </table>
    <p>
        The 'shape' property is a shorthand property for setting the individual shape properties
        at the same place in a style sheet.
    </p>

    <div class="example">
        <p>Style declaration using the 'shape' shorthand property.</p>
<pre><code class="html">
&lt;style type="text/css"&gt;
    .shape {
        shape: rectangle(50px, 50px, 200px, 100px) / url("shape_image.png")  0.7;
    }
&lt;/style&gt
</code></pre>
    </div>
    <p class="issue">The example above must be finished.</p>
    
    -->
    <!-- End section "Shape Shorthand property -->
    <!-- End section "Declaring Shapes" -->

    <h4 id="shape-margin-property">The 'shape-margin' property</h4>
    <p>
        The 'shape-margin' property adds a margin to a shape-outside. 
        This defines a new shape where every point 
        is the specified distance from the shape-outside. 
        This property takes on positive values only.
    </p>
    <table class="propdef">
        <tr>
            <th>Name:</th>
            <td><dfn title="'shape-margin'">shape-margin</dfn></td>
        </tr>
        <tr>
            <th>Value:</th>
            <td><var>&lt;length&gt;</var></td>
        </tr>
        <tr>
            <th>Initial:</th>
            <td>0</td>
        </tr>
        <tr>
            <th>Applies to:</th>
            <td>exclusion elements and floats</td>
        </tr>
        <tr>
            <th>Inherited:</th>
            <td>no</td>
        </tr>
        <tr>
            <th>Percentages:</th>
            <td>N/A</td>
        </tr>
        <tr>
            <th>Computed&nbsp;value:</th>
            <td>the absolute length</td>
        </tr>
    </table>

    <div class="example">
        <p>A 'shape-margin' creating an offset 
            from a circular shape-outside. 
            The blue rectangles represent 
            inline content affected 
            by the shape created 
            by the margin.</p>
        <img src="images/wrap-margin.png" 
            alt="Example of a shape-margin offset"/>
    </div>

    <!-- End section "shape-margin property" -->

    <h4 id="shape-padding-property">The 'shape-padding' Property</h4>
    <p>
        The 'shape-padding' property adds padding to a shape-inside. 
        This defines a new shape where every point 
        is the specified distance from the shape-inside. 
        This property takes on positive values only.
    </p>
    <table class="propdef">
        <tr>
            <th>Name:</th>
            <td><dfn title="'shape-padding'">shape-padding</dfn></td>
        </tr>
        <tr>
            <th>Value:</th>
            <td><var>&lt;length&gt;</var></td>
        </tr>
        <tr>
            <th>Initial:</th>
            <td>0</td>
        </tr>
        <tr>
            <th>Applies to:</th>
            <td>block-level elements</td>
        </tr>
        <tr>
            <th>Inherited:</th>
            <td>no</td>
        </tr>
        <tr>
            <th>Percentages:</th>
            <td>N/A</td>
        </tr>
        <tr>
            <th>Computed&nbsp;value:</th>
            <td>the absolute length</td>
        </tr>
    </table>

    <div class="example">
        <p>A 'shape-padding' creating an offset 
            from a circular shape-inside. 
            The light blue rectangles represent 
            inline content affected 
            by the shape created 
            by the padding.</p>
        <img src="images/shape-padding.png" 
            alt="Example of a shape-padding offset"/>
    </div>
    <!-- End section "shape-padding property" -->
    
    <div class="note">Note that the 'shape-padding' property only affects layout of content inside 
        the element it applies to while the 'shape-margin' property only affects layout of content 
        outside the element.</div>
    
    <!-- End section "Shapes" -->

    <h2 id="conformance">Conformance</h2>
    <!--conformance-->

    <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
      <p>This specification is made possible by input from 
          Andrei Bucur, 
          Alexandru Chiculita,
          Arron Eicholz, 
          Daniel Glazman,  
          Arno Gourdol, 
          Chris Jones, 
          Bem Jones-Bey, 
          Marcus Mielke, 
          Alex Mogilevsky, 
          Hans Muller, 
          Mihnea Ovidenie, 
          Virgil Palanciuc, 
          Peter Sorotokin, 
          Bear Travis, 
          Eugene Veselov, 
          Stephen Zilles 
          and the CSS Working Group members.
      </p>
      <h2 class="no-num" id="references">References</h2>
      <h3 class="no-num" id="normative-references">Normative references</h3>
      <!--normative-->
      <h3 class="no-num" id="other-references">Other references</h3>
      <!--informative-->
      <h2 class="no-num" id="index">Index</h2>
      <!--index-->
      <h2 class="no-num" id="property-index">Property index</h2>
      <!-- properties -->

          <!-- template markup for issues pulled from Bugzilla -->
          <script type="text/template" id="issue-template">
      <div class="issue-marker" data-bug_id="{{bug_id}}" data-bug_status="{{bug_status}}">
          <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id={{bug_id}}">Issue-{{bug_id}}</a>
          <div class="issue-details">
              <p class="short-desc">{{short_desc}}</p>
          </div>  
      </div>
          </script>   

          <script type="text/javascript" src="../shared/scripts/BugzillaTrackerUtil.js"></script>
          <script type="text/javascript" src="../shared/scripts/BugzillaTracker.js"></script>
          <script type="text/javascript">
              checkSpecificationIssues('CSS', 'Exclusions');        
          </script>
          
      <h2 class="no-num" id="change-log">Change Log</h2>
      
      <h3 class="no-num" >Since <a href="https://www.w3.org/TR/2012/WD-css3-exclusions-20120503/">May 3rd 2012</a></h3>
      <ul>
          <li>added inset-rectangle() to basic shapes</li>
          <li>Changed shape-inside overflow diagrams to show exclusion behavior</li>
          <li>Changed shape-inside to contribute to the wrapping context</li>
          <li>Defined exclusion edges relative to wrapping content's writing mode</li>
          <li>Made use of start, end, before and after consistent</li>
          <li>Added interpolation for basic shapes</li>
          <li>Changed basic shapes to depend on box specified with box-sizing</li>
          <li>Added overflow behavior for shape-inside.</li>
          <li>Added wrap-flow:minimum.</li>
          <li>Clarified processing model.</li>
          <li>Changed wrap-margin and wrap-padding to shape-margin and shape-padding.</li>
          <li>Removed wrap shorthand.</li>
      </ul>

      <h3 class="no-num" >Since <a href="https://www.w3.org/TR/2011/WD-css3-exclusions-20111213/">December 13th 2011</a></h3>
      <ul>
          <li>Clarified processing model.</li>
          <li>Clarified interaction with floats.</li>
          <li>Clarified that an exclusion element establishes a new block formatting context.</li>
      </ul>
      
  </body>
</html>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-declaration:"~/SGML/HTML4.decl"
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
sgml-nofill-elements:("pre" "style" "br")
sgml-live-element-indicator:t
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:t
sgml-general-insert-case:lower
sgml-always-quote-attributes:t
sgml-indent-step:nil
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
 
